#import "NSManagedObject+SMRAdditions.h"

@implementation NSManagedObject (SMRAdditions)

-(NSURL *)smrURIRepresentation {
	if ([[self objectID] isTemporaryID]) {
		NSError *error = nil;
		if (![[self managedObjectContext] obtainPermanentIDsForObjects:[NSArray arrayWithObject:self] error:&error])
			[NSApp presentError:error];
		return nil;
	}
    return [[self objectID] URIRepresentation];
}

-(NSString *)smrEntityName {
    return [[self entity] name];
}

-(NSString *)smrStringID {
    return [[self smrURIRepresentation] absoluteString];
}

@end
